package com.w.usercenter.common;

/**
 * @author wzp
 * @since 2024/8/10
 */
public class ResultUtils {

    public static <T> BaseResponse<T> succeed(T data) {
        return new BaseResponse<>(0, "0k", data);
    }

    public static BaseResponse error(Integer code, String msg) {
        return error(code, msg, null);
    }

    public static BaseResponse error(Integer code, String msg, String describe) {
        return new BaseResponse<>(code, msg, describe);
    }

    public static BaseResponse error(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode);
    }

    public static BaseResponse error(ErrorCode errorCode, String describe) {
        return new BaseResponse<>(errorCode.getCode(), errorCode.getMsg(), describe, null);
    }
}
